#!/bin/sh

# $Id: initramfs.cfg,v 1.3 2009-08-10 08:38:58 brian Exp $
# Copyright (c)2009-2011 Brian Manning
# brian at portaboom dot com
# PLEASE DO NOT E-MAIL THE AUTHOR ABOUT THIS SOFTWARE
# The proper venue for questions is the Portaboom mailing list at:
# http://groups.google.com/group/portaboom or <portaboom@groups.google.com>

# License: GPL v2 (see licence blurb at the bottom of the file)

# this is a simple script that has nothing but shell variables; this file is
# sourced by make_initramfs.sh in order to set up the build environment for
# making an initramfs image
KERNEL_VER="2.6.37-lack"
PROJECT_NAME="mystery_doom_project"
# for the issue file
RELEASE_DATE=$(/bin/date +%d%b%Y)
RELEASE_VER="2011.2 (${RELEASE_DATE})"
LACK_PASS="dawson32nd"

# export some stuff so other scripts can use it
export KERNEL_VER PROJECT_NAME RELEASE_DATE RELEASE_VER LACK_PASS

# note: most external software is now in a squashfs package of some sort; the
# below packages are here only because they are *REQUIRED* for the system to
# run;
RECIPES='
    _basedirs _baselibs.lenny mount-tools.lenny udev.lenny pam.lenny
    pam.locales lsb-base.lenny sudo libncurses5.lenny dialog portaboom-dirs
    debug-tools lspci.lenny usbutils lshw libstdc++.lenny
' # RECIPES

# for debugging...
#    debug-tools lspci.lenny usbutils lshw libstdc++.lenny

# portaboom-dirs is a set of directories in the initramfs image so stow
# doesn't choke when stowing wadfile packages

# program locations
GIT=$(which git)
PERL_GTK2_SRC="/dev/shm/perl-Gtk2"

# any files in this list get enumerated over and the substitutions below are
# performed on them
INPUT_FILES="
    etcfiles/issue.${PROJECT_NAME}
    etcfiles/issue.${PROJECT_NAME}.nogetty
" # INPUT_FILES

    # source the common build functions (used below)
    echo "- Sourcing common_release_functions located in ${BUILD_BASE}/scripts"
    source $BUILD_BASE/scripts/common_release_functions.sh

    # from make_initramfs.sh; sets OUTPUT_FILENAME
    if [ "x${LACK_WORK_DIR}" = "x" ]; then
        export LACK_WORK_DIR="/tmp"
    fi
    find_first_free_filename $LACK_WORK_DIR \
        "initramfs-${PROJECT_NAME}-${KERNEL_VER}"

    # do we need to clone the perl-Gtk2 repo?
    sync_perl_gtk2_source $PERL_GTK2_SRC
    check_exit_status $? "Syncing Perl-Gtk2 source to ${PERL_GTK2_SRC}"
    # copy the LACK SSL key/cert PEM file
    copy_lack_ssl_pem_file
    check_exit_status $? "Copying LACK SSL PEM key/cert file"
    # check the project filelist has been set by make_initramfs.sh
    check_empty_envvar "PROJECT_LIST" $PROJECT_LIST
    check_exit_status $? "PROJECT_LIST environment variable"
    # check the temp directory has been set by make_initramfs.sh
    check_empty_envvar "TEMP_DIR" $TEMP_DIR
    check_exit_status $? "TEMP_DIR environment variable"
    # check that the *.base.txt file exists for this project
    check_base_file_exists
    check_exit_status $? "${PROJECT_DIR}/${PROJECT_NAME}.base.txt file exists"
    # create the project filelist
    create_project_filelist
    check_exit_status $? "Create project filelist"
    # create the hostname file, put it in the temp dir
    create_hostname_file
    check_exit_status $? "Creating hostname file"
    # we want an init script that runs out of the initramfs
    create_init_initramfs_script
    check_exit_status $? "Creating initramfs init script"
    # copy the LACK SSL PEM file for shellinabox
    copy_lack_ssl_pem_file
    check_exit_status $? "Copying LACK SSL PEM key/cert file"
    # copy the busybox binary
    copy_busybox_binary
    check_exit_status $? "Copying busybox binary"
    # run INPUT_FILES through a sed filter
    sedify_input_files $INPUT_FILES
    check_exit_status $? "Applying 'sed' filters to input files"

# *begin licence blurb*
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA  02111-1307 USA

# vi: set sw=4 ts=4 ft=sh:
# конец!
